﻿//This file is part of the Generic Database Accessor Library (GDALib) project
//Copyright (C) 2009 Gentea Alexandru <in.10se@yahoo.com>
//
//This library is free software; you can redistribute it and/or
//modify it under the terms of the GNU Lesser General Public
//License as published by the Free Software Foundation; either
//version 2.1 of the License, or (at your option) any later version.
//
//This library is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
//Lesser General Public License for more details.
//
//You should have received a copy of the GNU Lesser General Public
//License along with this library; if not, write to the Free Software
//Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
using System.Data.SqlClient;

namespace GDALib
{
    /// <summary>
    /// Represents the type of the cached command.
    /// </summary>
    public enum SqlCommandType
    {
        /// <summary>
        /// The command is of type reader and should return a table.
        /// </summary>
        Reader,
        /// <summary>
        /// The command is of type scalar and should return the first column of the first row of the result table.
        /// </summary>
        Scalar, 
        /// <summary>
        /// The command is of type non-query and should return the number of affected rows.
        /// </summary>
        NonQuery,
        /// <summary>
        /// The command is of type reader and should return mutliple tables.
        /// </summary>
        MultiReader
    };

    class CachedSqlCommand
    {
        internal SqlCommand command;
        internal SqlCommandType type;

        public CachedSqlCommand(SqlCommand command, SqlCommandType type)
        {
            this.command = command;
            this.type = type;
        }
    }
}
